/**
 * webStorge
 * 1. 存储大小一般在5MB左右
 * 2. 浏览器通过Window.sessionStorage和Window.localStorage属性来实现本地存储机智
 * 3. 相关API
 *    - localStorage
 *    		- localStorage.setItem(key,value)
 *    		- localStorage.getItem(key)
 *    		- localStorage.removeItem(key)
 *    		- localStorage.clear()
 *    - sessionStorage
 *        - sessionStorage.setItem(key,value)
 *        - sessionStorage.setItem(key)
 *        - sessionStorage.removeItem(key)
 *        - sessionStorage.clear()
 * 4. 备注
 *    - SessStorage存储的内容随着浏览器窗口关闭而消失
 *    - localStorage 存储的内容,需要手动清除才会消失
 *    - getItem的值如果获取不到,则返回null
 *    - JSON.parse(null)的结果依然是null
 *
 */

const localStorageObj={
	setItem(key, value) {
		localStorage.setItem(key,value)
	},
	getItem(key){
		console.log(localStorage.getItem(key));
	},
	removeItem(key){
		localStorage.removeItem(key)
	},
	clear(){
		localStorage.clear()
	}
};
const sessionStorageObj={
	setItem(key, value) {
		sessionStorage.setItem(key,value)
	},
	getItem(key) {
		sessionStorage.setItem(key)
	},
	removeItem(key) {
		sessionStorage.removeItem(key)
	},
	clear() {
		sessionStorage.clear()
	}
};
